package com.jwsoft.manager.core.gateway.controller;

import com.jwsoft.manager.core.integration.EduhStudentEnrollKindergartenIntegration;
import com.jwsoft.manager.common.vo.eduhStudentEnrollKindergarten.EduhStudentEnrollKindergartenVO;
import com.jwsoft.manager.common.vo.eduhStudentEnrollKindergarten.EduhStudentEnrollKindergartenKeyVO;
import com.jwsoft.manager.common.vo.eduhStudentEnrollKindergarten.EduhStudentEnrollKindergartenQueryVO;
import com.github.pagehelper.PageInfo;
import com.bifang.engine.assistant.core.domain.AppResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import com.bifang.engine.protect.core.annotation.Idempotent;
import org.springframework.validation.annotation.Validated;
import com.bifang.assistant.common.constants.Validators;

/**
 * 幼儿园报名历史表网关
 *
 * @author zhiyuan
 * @since 2023-10-13
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "幼儿园报名历史表", description = "幼儿园报名历史表")
public class EduhStudentEnrollKindergartenController {

    @Autowired
    public EduhStudentEnrollKindergartenIntegration eduhStudentEnrollKindergartenIntegration;

    @Operation(summary = "幼儿园报名历史表分页查询",description = "幼儿园报名历史表分页查询")
    @PostMapping(value = "/hEnrollKindergarten0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduhStudentEnrollKindergartenVO>> getList(@RequestBody @Validated EduhStudentEnrollKindergartenQueryVO vo) {
        return AppResponse.successData(eduhStudentEnrollKindergartenIntegration.getList(vo));
    }

    @Operation(summary = "幼儿园报名历史表根据主键查询详情",description = "幼儿园报名历史表根据主键查询详情")
    @PostMapping(value = "/hEnrollKindergarten0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduhStudentEnrollKindergartenVO> getById(@RequestBody @Validated EduhStudentEnrollKindergartenKeyVO vo) {
        return AppResponse.successData(eduhStudentEnrollKindergartenIntegration.getById(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "幼儿园报名历史表新增",description = "幼儿园报名历史表新增")
    @PostMapping(value = "/hEnrollKindergarten0004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduhStudentEnrollKindergartenVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduhStudentEnrollKindergartenVO vo) {
        return AppResponse.successData(eduhStudentEnrollKindergartenIntegration.add(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "幼儿园报名历史表修改",description = "幼儿园报名历史表修改")
    @PostMapping(value = "/hEnrollKindergarten0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduhStudentEnrollKindergartenVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduhStudentEnrollKindergartenVO vo) {
        return AppResponse.successData(eduhStudentEnrollKindergartenIntegration.edit(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "幼儿园报名历史表删除",description = "幼儿园报名历史表删除")
    @PostMapping(value = "/hEnrollKindergarten0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduhStudentEnrollKindergartenKeyVO vo) {
        eduhStudentEnrollKindergartenIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }
}
